import Vue from 'vue';
import confirm from './index.vue';

const ConfirmConstructor = Vue.extend(confirm);
let instance;

const Confirm = function(options = {}) {
  instance = new ConfirmConstructor({
    data: options
  });
  document.body.appendChild(instance.$mount().$el);
  return instance.show();
};

export default {
  install(vue) {
    vue.prototype.$confirm = Confirm;
  }
};
